﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AAA.DataTransfer
{
    public abstract class AbstractTranslate : ITranslate
    {
        private ITranslate _parentTranslate;

        public AbstractTranslate() 
            : this(null) 
        { 
        }
       
        public AbstractTranslate(ITranslate translate)
        {
            _parentTranslate = translate;
        }        

        protected abstract object TryTranslate(object oValue);
    
        #region ITranslate 成員

        public object Translate(object oValue)
        {
            if (_parentTranslate != null)
                oValue = _parentTranslate.Translate(oValue);
            return TryTranslate(oValue);
        }

        #endregion
    }
}
